import request from '@/utils/request';

/** 获取联想建议（自动补全）API */
export const getSuggesAPI = (q: string) => {
  return request({
    url: '/v1_0/suggestion',
    params: {
      q,
    },
  });
};

export type SearchResultType = {
  page?: number;
  per_page?: number;
  keyWord: string;
};
/** 获取搜索结果API */
export const getSearchResultAPI = ({
  page = 1,
  per_page = 10,
  keyWord,
}: SearchResultType) => {
  return request({
    url: '/v1_0/search',
    params: {
      page,
      per_page,
      q: keyWord,
    },
  });
};
